package com.zyk.leetcode;

/**
 * @author zhangsan
 * @date 2021/4/12 15:16
 */
public class M0805 {

    // https://leetcode-cn.com/problems/recursive-mulitply-lcci/
    public int multiply(int A, int B) {
        if (A == 0 || B == 0)
            return 0;
        // 如果B大的话，就将A减少
        if (A < B)
            return B + multiply(A - 1, B);
        return A + multiply(A, B - 1);
    }

}
